<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>出入库明细</title>
    <jsp:include page="easyuiIncludeJS.jsp"/>

    <script type="text/javascript">
        $(function () {
            var pager = $(".easyui-datagrid").datagrid('getPager');
            $(pager).pagination({
                total:${pager.totalRows},
                pageSize:${pager.pageRow},
                displayMsg: '{from}-{to}/{total}',
                pageNumber:${pager.cur_page},
                afterPageText: '页，共{pages}页',
                pageList: [5, 10, 20, 30, 50, 100],
                loading: false,
                showPageList: true,
                showRefresh: true,
                //刷新方法
                onBeforeRefresh: function (p, s) {
                    location.href = "${pageContext.request.contextPath }/admin/report/listDetail?cur_page=" + p + "&pageRow=" + s;
                },
                onSelectPage: function (p, s) {
                    location.href = "${pageContext.request.contextPath }/admin/report/listDetail?cur_page=" + p + "&pageRow=" + s;
                }
            });
            $('#changesize').datagrid('resize', {
                height:document.body.clientHeight-100
            });
        });
      </script>
      <script type="text/javascript">
        function ss(val) {
        	$("#oprFlag").val(val);
            document.forms[0].submit();
        }

    </script>
</head>
<body>
<div id="tb">
	<table width="100%" border="0">
		<tr>
			<td>
			    <a class="easyui-linkbutton" plain="true" icon="icon-undo" href="javascript:void(0);" onclick="ss(1);">导出</a>
			</td>
			<td align="right">
			    <form id="form1" action="${pageContext.request.contextPath}/admin/report/listDetail" method="post">
				    <input type="hidden" name="oprFlag" id="oprFlag" value="0">
				    仓库: <select id="supplierId" name="supplierId">
						<option value="0">不选择</option>
						<c:forEach items="${storageList }" var="d">
						<c:if test="${ord.supplierId==d.storageId}">
							<option value="${d.storageId}" selected="selected">${d.storageName}(${d.storageCode})</option>
						</c:if>
						<c:if test="${ord.supplierId!=d.storageId}">
							<option value="${d.storageId}">${d.storageName}(${d.storageCode})</option>
						</c:if>
						</c:forEach>
					 </select>
					单据类别：<select name="orderType" id="orderType">
					<option value="0" <c:if test="${ord.orderType==0}">selected</c:if>>--不选择--</option>
					<option value="1" <c:if test="${ord.orderType==1}">selected</c:if>>采购入库单</option>
					<option value="2" <c:if test="${ord.orderType==2}">selected</c:if>>采购退货单</option>
					<option value="3" <c:if test="${ord.orderType==3}">selected</c:if>>销售出库单</option>
					<option value="4" <c:if test="${ord.orderType==4}">selected</c:if>>销售退货单</option>
					<option value="5" <c:if test="${ord.orderType==5}">selected</c:if>>盘点损益单</option>
				</select>
					物料名称:<input type="text" name="remark" id="remark" value="${ord.remark}" style="width: 100px">
					日期:<input class="easyui-datebox" id="orderDate" name="orderDate" value="${ord.orderDate}" editable="false"  style="width:130px;">
				   -<input class="easyui-datebox" id="orderDate2" name="orderDate2" value="${ord.orderDate2}" editable="false" style="width:130px;">
			        <a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="ss(0);" iconCls="icon-search" >搜索</a>
			    </form>
			</td>
		</tr>
	</table>
</div>
<table class="easyui-datagrid" id="changesize" pagination="true" style="height:620px;width: auto;" singleSelect="true">
    <thead>
    <tr>
        <th width="150" align="center" field="orderNo">单据编号</th>
        <th width="90" align="center" field="orderDate">单据日期</th>
        <th width="80" align="center" field="empName">开单人</th>
		<th width="80" align="center" field="orderType">单据类型</th>
		<th width="120" align="center" field="supplierName">供应商</th>
        <th width="80" align="center" field="materialCode" >物料编码</th>
        <th width="120" align="center" field="materialName">物料名称</th>
        <th width="130" align="center" field="batchNo">原料批号</th>
        <th width="120" align="center" field="orderId">采购编号</th>
        <th width="120" align="center" field="storageName">仓库</th>
		<th width="100" align="center" field="orderCnt">入库数量</th>
		<th width="100" align="center" field="orderFlag">冲红</th>

	</tr>
    </thead>
    <tbody>
    <c:forEach items="${pager.datas}" var="d">
		<c:forEach items="${d.detailList}" var="dd">
			<tr>
				<td>${d.orderNo}</td>
				<td>${d.orderDate.substring(0,10)}</td>
				<td>${d.empName}</td>
				<td>
					<c:if test="${d.orderType==1}">采购入库单</c:if>
					<c:if test="${d.orderType==2}">采购退货单</c:if>
					<c:if test="${d.orderType==3}">销售出库单</c:if>
					<c:if test="${d.orderType==4}">销售退货单</c:if>
					<c:if test="${d.orderType==5}">盘点损益单</c:if>
				</td>
				<td>${d.supplierName}</td>
				<td>${dd.materialCode}</td>
				<td>${dd.materialName}</td>
				<td>${dd.batchNo}</td>
				<td>${dd.orderId}</td>
				<td>${dd.storageName}</td>
				<td>${dd.orderCnt}</td>
				<td>${dd.orderFlag}</td>
			</tr>
		</c:forEach>
    </c:forEach>
    </tbody>
</table>
</body>
</html>